﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VonaJobs.DAL.DAO;
using VonaJobs.DAL.Gatway;

namespace VonaJobs.BLL
{
    public class EmployerUserManager
    {
        EmployerUserGateway employerUserGateway = new EmployerUserGateway();
        public string CreateNewEmploye(EmployerUser employerUser)
        {
            try
            {
                if (!HasThisEmployerExist(employerUser))
                {
                    return employerUserGateway.SaveEmployerUser(employerUser);
                }
            }
            catch (Exception)
            {
                
                throw;
            }
            return "Create successfull";
        }

        private bool HasThisEmployerExist(EmployerUser employerUser)
        {
            try
            {
                return employerUserGateway.HasThisEmployerExist(employerUser);
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        public string ChangeEmpPassword(EmployerUser employerUser)
        {
            try
            {
                if (HasThisEmailPass(employerUser))
                {
                    return employerUserGateway.SaveEmployerUser(employerUser);
                }
            }
            catch (Exception)
            {
                
                throw;
            }
            return "Password change successfully";
        }

        private bool HasThisEmailPass(EmployerUser employerUser)
        {
            try
            {
                return employerUserGateway.HasThisEmailPass(employerUser);
            }
            catch (Exception)
            {
                
                throw;
            }
            
        }
    }
}